<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    const arr = ['nae', 'age', 'groud', 'sex'];
    let [x] = arr;
    console.log(x);

    // console.log(s);
    // console.log(d);
    // console.log(g);

    const obj = {
        name: '1',
        age: '2',
        fun: function () {
            console.log(1111);
        }
    }
    let { age: ages, name: names, fun } = obj;
    // 从obj对象解构出来的两个属性age，name，将值分别赋给变量ages,names
    // 直接用ages就可以拿到age的值
    console.log(ages);
    console.log(names);
    console.log(fun);
    fun();
    fun();
</script>

</html>